/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tutorial.DesignPatterns.Factory;

import tutorial.DesignPatterns.Factory.Factory.AbstractVehicleFactory;
import tutorial.DesignPatterns.Factory.Factory.CarFactory;
import tutorial.DesignPatterns.Factory.Factory.VehicleFactory;
import tutorial.DesignPatterns.Factory.Factory.VehicleType;
import tutorial.DesignPatterns.Factory.Product.Vehicle;

/**
 *
 * @author Boogie
 */
public class FactoryMain {
    public static void main(String[] args){
        
        VehicleFactory factory = new VehicleFactory();
        /*
         * In program nu se stie nici macar numule clase care implemeteaza interfata
         * (in cazul de fata stii cat de cat ca urmeaza sa primesti implementarea Plane)
         */
        Vehicle v = factory.createVehicle(VehicleType.PLANE);
        
        v.go();
        System.out.println(v.otherStuff());
        
        /*
         * In varianta aceasta se folosete un AbstractFactory, care se 
         * instanteza cu implementarea potrivita
         * in cazul acesta se ascunde total implementarea produsului (Vehicle)
         * 
         */        
        AbstractVehicleFactory abstractFactory = new CarFactory();
        Vehicle v2 = abstractFactory.createVehicle();
        
        v2.go();
        System.out.println(v2.otherStuff());
        
    }
}
